package com.dragon.mmochat.model;

import java.util.ArrayList;
import java.util.List;

import com.dragon.mmochat.MmochatConstant;
import com.dragon.mmochat.model.enumType.MmochatEquipAttributeType;
import com.dragon.mmochat.model.enumType.MmochatPropType;
import com.dragon.mmochat.model.map.MmochatMap;
import com.dragon.mmochat.model.object.MmochatEquipAttribute;
import com.dragon.mmochat.model.role.MmochatPlayer;
import com.dragon.mmochat.service.MmochatMapService;

//强化丹
public class MmochatStrengthDrug {

	public static boolean isStrengthDrugProp(MmochatPropType type) {
		return type.getEffectKey() >= MmochatConstant.minStrenthDrugEffectKey
				&& type.getEffectKey() <= MmochatConstant.maxStrenthDrugEffectKey;
	}

	// 通过地图ID获得可能掉落的强化丹类型
	public static MmochatPropType getStrengthDrugTypeByMapId(int mapId) {
		MmochatMap map = MmochatMapService.maps.get(mapId);
		if (map != null) {
			String name = "强化丹o" + map.getMapName();
			try {
				MmochatPropType type = MmochatPropType.valueOf(name);
				return type;
			} catch (Exception e) {
				return null;
			}
		}
		return null;
	}

	public static int getEquipAttrValue(MmochatPlayer me,
			MmochatEquipAttributeType type) {
		int sum = 0;

		for (int effectKey = MmochatConstant.minStrenthDrugEffectKey; effectKey <= MmochatConstant.maxStrenthDrugEffectKey; effectKey++) {
			MmochatPropType propType = MmochatPropType
					.getPropTypeByEffectKey(effectKey);
			if (propType != null) {
				if (me.hasPropEffect(propType.getEffectKey())) {
					List<MmochatEquipAttribute> extraAttr = getAttrListOfStrenthDrug(propType);
					if (extraAttr != null) {
						for (MmochatEquipAttribute attr : extraAttr) {
							if (attr.getType() == type) {
								sum += attr.getValue();
							}
						}
					}
				}

			}
		}
		return sum;
	}

	public static List<MmochatEquipAttribute> getAttrListOfStrenthDrug(
			MmochatPropType propType) {
		List<MmochatEquipAttribute> attrList = new ArrayList<MmochatEquipAttribute>();
		switch (propType) {
		case 强化丹o东郊: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.抗雷, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.法防加成, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.气血加成, 10));
			break;
		}
		case 强化丹o渡口: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.抗水, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.法防加成, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.气血加成, 10));
			break;
		}
		case 强化丹o南郊: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.抗毒, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.法防加成, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.气血加成, 10));
			break;
		}
		case 强化丹o死海: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.忽视抗雷, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.法伤加成, 3));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.法力加成, 20));
			break;
		}
		case 强化丹o天山: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.忽视抗水, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.法伤加成, 3));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.法力加成, 20));
			break;
		}
		case 强化丹o碧湖: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.忽视抗毒, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.法伤加成, 3));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.法力加成, 20));
			break;
		}
		case 强化丹o东海: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.抗雷, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.抗水, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.抗毒, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.气血加成, 10));
			break;
		}
		case 强化丹o北郊: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.抗雷, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.抗水, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.抗毒, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.速度加成, 5));
			break;
		}
		case 强化丹o远郊: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.忽视抗雷, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.忽视抗水, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.忽视抗毒, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.法力加成, 20));
			break;
		}
		case 强化丹o岐山: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.忽视抗雷, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.忽视抗水, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.忽视抗毒, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.速度加成, 5));
			break;
		}
		case 强化丹o灵山: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.封印抵抗, 10));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.物防加成, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.气血加成, 10));
			break;
		}
		case 强化丹o冥府: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.冰冻抵抗, 10));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.物防加成, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.气血加成, 10));
			break;
		}
		case 强化丹o妖谷: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.混乱抵抗, 10));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.物防加成, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.气血加成, 10));
			break;
		}
		case 强化丹o西海: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.忽视封印抵抗, 10));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.强化封印, 3));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.法力加成, 20));
			break;
		}
		case 强化丹o天外: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.忽视冰冻抵抗, 10));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.强化冰冻, 3));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.法力加成, 20));
			break;
		}
		case 强化丹o心湖: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.忽视混乱抵抗, 10));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.强化混乱, 3));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.法力加成, 20));
			break;
		}
		case 强化丹o九幽: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.全异常抵抗, 8));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.物防加成, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.气血加成, 10));
			break;
		}
		case 强化丹o沼泽: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.忽视全异常抵抗, 8));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.强化全异常, 3));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.法力加成, 20));
			break;
		}
		case 强化丹o海外: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.物理暴击, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.物伤加成, 3));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.速度加成, 5));
			break;
		}
		case 强化丹o上清: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.法术暴击, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.法伤加成, 3));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.速度加成, 5));
			break;
		}
		case 强化丹o西郊: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.物防加成, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.法防加成, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.气血加成, 10));
			break;
		}
		case 强化丹o铁血: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.物防加成, 10));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.法防加成, 10));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.气血加成, 20));
			break;
		}
		case 强化丹o幻影: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.忽视全异常抵抗, 10));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.强化全异常, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.速度加成, 10));
			break;
		}
		case 强化丹o高力: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.物理暴击, 10));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.物伤加成, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.速度加成, 8));
			break;
		}
		case 强化丹o通灵: {
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.法术暴击, 10));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.法伤加成, 5));
			attrList.add(new MmochatEquipAttribute(
					MmochatEquipAttributeType.速度加成, 8));
			break;
		}
		default:
			break;
		}
		return attrList;
	}
}
